#include <iostream>
using namespace std;
typedef long long LL;
const int N = 20;
char c[N];
LL ans;
int a , b;
void dfs(int i , LL v)
{
    int x = c[i] - '0';
    if(c[i])
    {
        int t = min(a,9 - x);
        a -= t;
        dfs(i + 1, v * 10 + t + x);
        a += t;
        if(b > x)
        {
            b -= x + 1;
            dfs(i + 1,v * 10 + 9);
            b += x + 1;
        }
    }
    else
    {
        ans = max(ans,v);
    }
}
int main()
{
  cin >> c >> a >> b;
  dfs(0,0);
  cout << ans;
  return 0;
}
